package github.sf.fw.check.exception;

/**
 * 运行DDL语句异常
 */
public class ExecuteDDLException extends RuntimeException {

    private static final long serialVersionUID = -3900660431714150617L;

    public ExecuteDDLException() {
        super();
    }

    public ExecuteDDLException(String message) {
        super(message);
    }

    public ExecuteDDLException(String message, Throwable cause) {
        super(message, cause);
    }

    public ExecuteDDLException(Throwable cause) {
        super(cause);
    }

    protected ExecuteDDLException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public static void throwException(String message, Throwable cause) {
        Throwable rootCause = cause;
        if (cause != null && cause.getCause() != null) {
            rootCause = cause.getCause();
        }
        throw new ExecuteDDLException(message, rootCause);
    }

    public static void throwException(Throwable cause) {
        throwException(null, cause);
    }
}
